using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class users
    {
            public long id{get;set;}
            public string username{get;set;}
            public string password{get;set;}
            //public string repeatpasswordext { get; set; }//De xac nhan viec retype pass word
            public string fullname{get;set;}
            public string email{get;set;}
            public string address{get;set;}
            public string indentitycard{get;set;}
            public string numberphone{get;set;}
            public bool active{get;set;}
            public DateTime createdate{get;set;}
            public DateTime modifieddate{get;set;}
            public DateTime birthday { get; set; }
         
        public users()
        {       
                    username ="";   
                    password ="";
                    //repeatpasswordext = "";
                    fullname ="";   
                    email ="";   
                    address ="";   
                    indentitycard ="";   
                    numberphone ="";   
        }
        
       static users DynamicCast<T>(object row_data, object row_header) where T : users
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           users ret = new users();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "id":
                        ret.id = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "username":
                        ret.username = ConvertObject.ToString(dt[column]);
                       break;
                      case  "password":
                        ret.password = ConvertObject.ToString(dt[column]);
                       break;
                      case  "fullname":
                        ret.fullname = ConvertObject.ToString(dt[column]);
                       break;
                      case  "email":
                        ret.email = ConvertObject.ToString(dt[column]);
                       break;
                      case  "address":
                        ret.address = ConvertObject.ToString(dt[column]);
                       break;
                      case  "indentitycard":
                        ret.indentitycard = ConvertObject.ToString(dt[column]);
                       break;
                      case  "numberphone":
                        ret.numberphone = ConvertObject.ToString(dt[column]);
                       break;
                      case  "active":
                        ret.active = ConvertObject.ToBool(dt[column]);
                       break;
                      case  "createdate":
                        ret.createdate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "modifieddate":
                        ret.modifieddate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case "birthday":
                       ret.birthday = ConvertObject.ToDateTime(dt[column]);
                       break;
                      //case "repeatpasswordext":
                      // ret.repeatpasswordext = ConvertObject.ToString(dt[column]);
                      // break;
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
